import { request } from '@@/plugin-request/request';
import { useEffect } from 'react';

import './index.css';

const AllAgreeMent = ({ path }: any) => {
  function getStream() {
    request('images/' + path, {
      method: 'get',
      responseType: 'blob',
    }).then((res) => {
      const blob = new Blob([res], {
        type: 'application/pdf',
      });
      const url = URL.createObjectURL(blob);
      console.log('blob>>>', blob, res, url);
      // @ts-ignore
      document.getElementById('iframe').src = url + '#toolbar=0';
    });
  }
  useEffect(() => {
    getStream();
  }, []);

  return (
    <iframe src="" id="iframe" frameBorder="0" style={{ width: '100%', height: '100%', position: 'absolute' }}  />
  );
};
export default AllAgreeMent;
